/**
 * @Author: 耿立强
 * @Date: 2019/6/20
 * @Last Modified by:   耿立强
 * @Last Modified time: 2019-06-20 15:45:00
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 三包法规列表
export const listRecord = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/listRecord`, params);
export const listRecordNew = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/regulationsMaintain/list`, params);
export const assemblyAndRegulationsListRecordNew = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyAndRegulationsMaintain/list`, params);
export const assemblyPartList = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyPart/list`, params);

//三包法规详情
export const getByThreeId = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/getByThreeId`, {params});
export const getByAssemblyId = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/getByAssemblyId`, {params});
export const getByAssemblyPartId = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/getByAssemblyPartId`, {params});

//导出列表
export const exportListRecord = params =>
{
  return axios({
    url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/exportListRecord`,
    method: 'get',
    params:params,
    responseType: 'blob'
  });
};
//维护更新
export const updateMaintain = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/regulationsMaintain/update`,  params );
//规则总成关系新增
export const addAssembly = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyAndRegulationsMaintain/add`,  params );
export const addAssemblyPart = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyPart/add`,  params );
//规则总成关系编辑
export const editAssembly = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyAndRegulationsMaintain/edit`,  params );
export const editAssemblyPart = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyPart/edit`,  params );
export const deleteAssembly = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyAndRegulationsMaintain/delete`,  params );
export const deleteAssemblyPart = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyPart/delete`,  params );

//导出模版
export const downloadModel = params => {
  const url = `${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/assemblyPart/exportModel`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};


